<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div>
            {{date.year}}-{{date.month | time}}-{{date.ri | time}}
            {{date.h | time}}:{{date.m |time}}:{{date.s | time}}
        </div>
    </div>
</body>
<script src="js/vue.js"></script>
<script>
    let vm = new Vue({
        el:"#app",
        data:{
            date:{year:'',month:'',ri:'',h:'',m:'',s:''}
        },
        filters:{
            time(val){
                if(val<10){
                    return '0'+val
                }
                return val
            }
        },
        mounted(){
            var dd = setInterval(()=>{
                let date = new Date()
                this.date.year = date.getFullYear()
                this.date.month = date.getMonth()+1
                this.date.ri = date.getDate()
                this.date.h = date.getHours()
                this.date.m = date.getMinutes()
                this.date.s = date.getSeconds()
            },1000)
        },
        beforeDestroy(){
            clearInterval(dd)
        },
       
    })
</script>
</html>